#pragma once

#include "Vector3.h"

class Plane : D3DXPLANE
{
	// Methods

	public:

		inline void Normalize()
		{
			float mag;

			mag = sqrt((this->a * this->a) + 
				       (this->b * this->b) + 
					   (this->c * this->c));

			this->a = this->a / mag;

			this->b = this->b / mag;

			this->c = this->c / mag;

			this->d = this->d / mag;
		}

		bool Inside(const Vector3 &point) const;

		bool Inside(const Vector3 &point, const float radius) const;

	// Static

	public:

		static inline Plane& BuildFromPoints(const Vector3 &p0, const Vector3 &p1, const Vector3 &p2)
		{
			Plane* plane;

			D3DXPlaneFromPoints(
				plane,
				&p0,
				&p1,
				&p2);

			(*plane).Normalize();

			return *plane;
		}
};